#lang racket
(define-struct Student (last first teacher))

(define (Teacher student)
  (Student-teacher student)
  )

(define (LastName student)
  (Student-last student)
  )

(define (FirstName student)
  (Student-first student)
  )

(define (check student teacher)
   (cond
     [(symbol=? (Teacher student) teacher)
      (LastName student)]
     [else 'None]
     )
  )

(define (transfer student teacher)
   (make-Student (LastName student) (FirstName student) teacher)
  )

(define (subst-teacher student teacher)
   (cond
     [(symbol=? (check student 'Fritz) 'None)
               student]
     [else (transfer student teacher)])
  )

(define a-student (make-Student 'Li 'Andy 'Wendy))
(define b-student (make-Student 'Li 'Okay 'Fritz))

(LastName a-student)
(FirstName a-student)
(Teacher a-student)

(display "\n")

(LastName b-student)
(FirstName b-student)
(Teacher b-student)

(display "\n")

(define c-student (subst-teacher a-student 'Python))
(define d-student (subst-teacher b-student 'Python))

(LastName c-student)
(FirstName c-student)
(Teacher c-student)

(display "\n")

(LastName d-student)
(FirstName d-student)
(Teacher d-student)


